<template>
	<view>
		<view class="fui-header fui-header-success">
			<view class="fui-header-left iconfont icon-fanhui" @click="result" ></view>
			<view class="title">数据统计</view>
		</view>
		<view class="status_bar"></view>
		<v-tabs
		 
		  :scroll="false"
		  :tabs="nav"
		  :bold="false"
		   v-on:change="change"  
		></v-tabs>

		<view class="fui-list-group" id="container" v-if="show==false">
			<view class="fui-tab-o fui-tab-success auto">
				<uni-segmented-control  :values="items" :style-type="styleType" :active-color="activeColor" @clickItem="onClickItem" />
			</view>
			<view class="fui-panel" style="font-size:0.65rem;">
				<view class="fui-panel" style="font-size:0.65rem;">
					<view class="fui-panel-header">		                    
						交易额：<span style="color:red;"  >{{list.totalcount}}</span>，
						最高交易额 <span style="color:red;" >{{list.maxcount}}</span><span>({{list.maxcount_date}})</span>		                    
					</view>
					<view class="panel-body">
						<view class="panel_t">
							<view>日期</view>
							<view>交易额</view>
							<view>比例</view>
						</view>
						<view class="panel_b" v-for="(key, index) in list.list" :key="index">
							<view>{{list.list[index].data}}</view>
							<view>{{list.list[index].count}}</view>
							<view>{{list.list[index].percent}}%</view>
						</view>
						
					</view>
				</view>
			</view>
		
			
		</view>
		<view class="fui-list-group" id="container" v-if="show">
			<view class="panel-body">
				<view class="panel_bs">
					<view>
						<view>订单总金额</view>
						<view>2</view>
					</view>
					<view>
						<view>总会员数</view>
						<view>5</view>
					</view>
					<view>
						<view>会员消费率</view>
						<view>40%</view>
					</view>
				</view>
				<view class="panel_bs">
					<view>
						<view>订单总金额</view>
						<view>2</view>
					</view>
					<view>
						<view>总访问次数</view>
						<view>118</view>
					</view>
					<view>
						<view>访问转化率</view>
						<view>2%</view>
					</view>
				</view>
				<view class="panel_bs">
					<view>
						<view>总订单数</view>
						<view>7</view>
					</view>
					<view>
						<view>总访问次数</view>
						<view>118</view>
					</view>
					<view>
						<view>订单转化率</view>
						<view>6%</view>
					</view>
				</view>
				<view class="panel_bs">
					<view>
						<view>消费会员数</view>
						<view>4</view>
					</view>
					<view>
						<view>总会员数</view>
						<view>5</view>
					</view>
					<view>
						<view>会员消费率</view>
						<view>80%</view>
					</view>
				</view>
				<view class="panel_bs">
					<view>
						<view>总订单数</view>
						<view>7</view>
					</view>
					<view>
						<view>总会员数</view>
						<view>5</view>
					</view>
					<view>
						<view>订单购买率</view>
						<view>101.4%</view>
					</view>
				</view>
			</view>
		</view>
		<view class="bstatus_bar"></view>
		<footernav></footernav>
	</view>
</template>

<script>
	var t = getApp().globalData,
		e = t.requirejs('core'),
		i = t.requirejs('foxui'),
		a = t.requirejs('jquery');
	export default {
		data() {
			return {
				nav:['销售统计', '销售指标'],
				navKey:[
				  'sale',
				  'sale_analysis'
				],
				items: ['交易额', '交易量'],
				
				activeColor: '#5cb85c',
				styleType: 'button',
				type:0,
				list:[],
				show:0
				
			}
			
		},
		onLoad(){
			 this.init()
		},
		methods: {
			
			init(){
				let self=this
				e.get('merchmanage.statistics.getsale', {type:this.type}, function(t) {
						self.list=t.result
				});
			},
			change(index){
				
				this.show=index
			},
			//返回上一页
			result(){
				uni.navigateBack({
					 delta: 1
				});
			},
			onClickItem(e) {
				this.type=e.currentIndex
				this.init()
			}
		}
	}
</script>

<style>
.fui-header .iconfont{
	color: #fff;
	font-size: 24rpx;
	padding: 0 20rpx;
}
.fui-list-group{
	padding-top: 20rpx;
}
.fui-tab-o{
	display: block;
}
.fui-panel {
    height: auto;
    padding: 10rpx;
    margin: 10rpx;
    background: #fff;
    overflow: hidden;
}
.panel_t,.panel_b{	
	display: flex;
	justify-content: space-between;
	line-height: 70rpx;
}
.panel_bs{
	display: flex;
	justify-content: space-between;
	line-height: 50rpx;
}
.panel_t{
	font-weight: bold;
}
.panel_t>view,.panel_b>view,.panel_bs>view{
	width: 33.33%;
	text-align: center;
}

</style>
